import request from '@/utils/request'

const baseURL = '/api/dept'

export function getDeptList({
  page, pageSize, params = {}, data
}) {
  return request({
    url: baseURL + '/list',
    method: 'post',
    params: {
      page, pageSize,
      ...params
    }, data
  })
}

export function getDeptSimpleList({
  data
}) {
  return request({
    url: baseURL + '/simpleList',
    method: 'post',
    data
  })
}

export function getOneDept(id) {
  return request({
    url: baseURL + `/${id}`,
    method: 'get'
  })
}

export function addDept(data) {
  return request({
    url: baseURL,
    method: 'post',
    data
  })
}

export function updateDept(id, data) {
  return request({
    url: baseURL + `/${id}`,
    method: 'put',
    data
  })
}

export function deleteOneDept(id) {
  return request({
    url: baseURL + `/${id}`,
    method: 'delete'
  })
}

export function getMajorTreeList() {
  return request({
    url: baseURL + `/majorTreeList`,
    method: 'get'
  })
}

export function getTeacherTreeList() {
  return request({
    url: baseURL + `/teacherTreeList`,
    method: 'get'
  })
}

export function getClassTreeList() {
  return request({
    url: baseURL + `/classTreeList`,
    method: 'get'
  })
}

export function getCourseTreeList() {
  return request({
    url: baseURL + `/courseTreeList`,
    method: 'get'
  })
}
